package com.xz.example;

import com.xz.example.exception.UnsupportedShapeException;
import com.xz.example.factory.Shape;

/**
 * @author 张志航     
 * @version V1.0.0
 * @projectName design_mode
 * @title     Client   
 * @package    com.xz.example  
 * @date   2019/11/25 19:53  
 * @explain
 */
public class Client {

    /**
     * 设计一个可以创建不同的集合形状的绘图工具类,每个集合形状均能绘制与擦除
     * @param args
     */
    public static void main(String[] args) {
        //drawCircle();
        //drawRectangle();
        //drawTriangle();
        drawNothing();
    }

    private static void drawCircle()  {
        try {
            Shape yuan = Shape.getShape("yuan");
            yuan.draw();
            yuan.erase();
        } catch (UnsupportedShapeException e) {
            e.printStackTrace();
        }
    }

    private static void drawRectangle()  {
        try {
            Shape yuan = Shape.getShape("fang");
            yuan.draw();
            yuan.erase();
        } catch (UnsupportedShapeException e) {
            e.printStackTrace();
        }
    }

    private static void drawTriangle()  {
        try {
            Shape yuan = Shape.getShape("sanjiao");
            yuan.draw();
            yuan.erase();
        } catch (UnsupportedShapeException e) {
            e.printStackTrace();
        }
    }

    private static void drawNothing()  {
        try {
            Shape yuan = Shape.getShape("");
            yuan.draw();
            yuan.erase();
        } catch (UnsupportedShapeException e) {
            e.printStackTrace();
        }
    }

}
